package test_operator

import "fmt"

func Do() {
	//算数运算符
	fmt.Println("算数运算符")
	var a = 3
	var b = 4
	a++
	b--
	fmt.Println("a=", a)
	fmt.Println("b=", b)
	fmt.Println("a+b=", a+b)
	fmt.Println("a-b=", a-b)
	fmt.Println("axb=", a*b)
	fmt.Println("a/b=", a/b)
	fmt.Println("a%b=", a%b)

	//关系运算符
	fmt.Println("关系运算符")
	fmt.Println(a > b)
	fmt.Println(a < b)
	fmt.Println(a == b)
	fmt.Println(a != b)
	fmt.Println(a >= b)
	fmt.Println(a <= b)

	//逻辑运算符
	fmt.Println("逻辑运算符")
	fmt.Println(false && true)
	fmt.Println(false || true)
	fmt.Println(!false)

	//位运算
	fmt.Println("位运算")
	// 1: 01
	// 2: 10
	fmt.Println(1 & 2)  //0
	fmt.Println(1 | 2)  //3
	fmt.Println(1 ^ 2)  //3
	fmt.Println(1 << 1) //2
	fmt.Println(1 >> 1) //0
}
